home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / utility / csap421.zip / DOSSTRUC.H < prev    next >
C/C++ Source or Header  |  1994-01-03  |  5KB  |  172 lines

  1. #ifndef DOS_DATE
  2. #define DOS_DATE
  3. typedef union {
  4.         unsigned        u;
  5.         struct {
  6.                 unsigned        Day:5;
  7.                 unsigned        Month:4;
  8.                 unsigned        Year:7;
  9.                 }               b;
  10.         }               DOS_FILE_DATE;
  11. #endif
  12.  
  13. #ifndef DOS_TIME
  14. #define DOS_TIME
  15. typedef union {
  16.         unsigned        u;
  17.         struct {
  18.                 unsigned        Second:5;
  19.                 unsigned        Minute:6;
  20.                 unsigned        Hour:5;
  21.                 }               b;
  22.         }               DOS_FILE_TIME;
  23. #endif
  24.  
  25. /* DpbStruct -- Layout of parameter block returned by Int 21H, Fn 32H    */
  26. /* This function is an undocumented MS-DOS service but has  */
  27. /* been verified to work correctly on PC/MS-DOS 2.0 through */
  28. /* PC/MS-DOS 3.3                                            */
  29.  
  30. struct DOS_2 {
  31.         unsigned char FatSize;
  32.         unsigned          DirStart;
  33.         unsigned long ddh;
  34.         unsigned char MediaType;
  35.         unsigned char Rebuild;
  36.         unsigned long NextTable;
  37.         unsigned          CurDir1st;
  38.         char              CurDirPath[64];
  39.         };
  40.  
  41. struct DOS_3 {
  42.         unsigned char FatSize;
  43.         unsigned          DirStart;
  44.         unsigned long ddh;
  45.         unsigned char MediaType;
  46.         unsigned char Rebuild;
  47.         unsigned long NextTable;
  48.         unsigned          FreeSearchClus;
  49.         unsigned          FreeCluster;
  50.         };
  51.  
  52. struct DOS_4 {
  53.         unsigned        FatSize;
  54.         unsigned                DirStart;
  55.         unsigned long   ddh;
  56.         unsigned char   MediaType;
  57.         unsigned char   Rebuild;
  58.         unsigned long   NextTable;
  59.         unsigned                FreeSearchClus;
  60.         unsigned                FreeCluster;
  61.         };
  62.  
  63. struct DpbStruct {
  64.         unsigned char   Designator;                     /* Drive # (0=A, 1=B, ...)       */
  65.         unsigned char   AltDesignator;          /* As above; 0 if RAMdisk        */
  66.         unsigned        SectorSize;                     /* Bytes per Sector              */
  67.         unsigned char   ClusterSize;            /* Sectors per Cluster - 1       */
  68.         unsigned char   ClusterShift;           /* Log2 (Sectors per Clus)       */
  69.         unsigned        FatStart;                       /* Sectors in Boot Record        */
  70.         unsigned char   FatCopies;                      /* Copies of FAT                 */
  71.         unsigned        MaxEntries;                     /* Max entries in Root Directory */
  72.         unsigned        DataStart;                      /* 1st sector of data area       */
  73.         unsigned        LastCluster;            /* Last cluster number           */
  74.         union {
  75.                 struct DOS_2 V2;
  76.                 struct DOS_3 V3;
  77.                 struct DOS_4 V4;
  78.                 } V;
  79.         };
  80.  
  81.  
  82. /*
  83.  * ExtendedHeader -- header used in constructing an extended file control
  84.  * block.
  85.  */
  86.  
  87. struct ExtendedHeader {
  88.         char            Header;
  89.         char            Zeros[5];
  90.         char            Attrib;
  91. };
  92. /* ExtFcb -- extended file control block */
  93.  
  94. struct ExtFcb {
  95.         struct ExtendedHeader FcbHdr;
  96.         char            DriveId;
  97.         char            FileName[8];
  98.         char            FileExtension[3];
  99.         unsigned        CurBlock;
  100.         unsigned        RecSize;
  101.         long            FileSize;
  102.         DOS_FILE_DATE   Date;
  103.         DOS_FILE_TIME   Time;
  104.         char            Reserved[8];
  105.         char            RecInBlock;
  106.         long            RelRecord;
  107. };
  108. /*
  109.  * DirDta -- dta directory entry structure
  110.  */
  111.  
  112. struct DirDta {
  113.         char            DriveNum;
  114.         char            FileName[11];
  115.         char            Attributes;
  116.         char            Unused[10];
  117.         DOS_FILE_TIME   CreateTime;
  118.         DOS_FILE_DATE   CreateDate;
  119.         unsigned        FirstCluster;
  120.         long            FileSize;
  121. };
  122. /*
  123.  * DirEntry -- format of an entry in the directory
  124.  */
  125.  
  126. struct DirEntry {
  127.         unsigned char   Name[8];
  128.         char            Ext[3];
  129.         char            Attribute;
  130.         char            Reserved[10];
  131.         unsigned        ModifyTime;
  132.         unsigned        ModifyDate;
  133.         unsigned        FirstCluster;
  134.         long            FileSize;
  135. };
  136. /*
  137.  * ExtendedEntry -- directory structure for use with extended file search
  138.  */
  139.  
  140. struct ExtendedEntry {
  141.         struct ExtendedHeader DirHdr;
  142.         struct DirDta   Body;
  143. };
  144.  
  145. struct ClusterEntry {
  146.         struct ClusterEntry *Next;
  147.         unsigned        Cluster;
  148. };
  149.  
  150. struct ClusterQueue {
  151.         struct ClusterEntry *Head, *Current;
  152.         int             Count;
  153. };
  154.  
  155.  
  156. struct absr32m
  157.  {
  158.   long sector;
  159.   int  nsect;
  160.   unsigned char far  *xferad;
  161.  };
  162.  
  163. #define FAT_BLK 57344U
  164. #define INT_FAT_BLK (FAT_BLK / 2)
  165.  
  166. #if defined(MAIN)
  167.         #define EXTERN
  168. #else
  169.         #define EXTERN extern
  170. #endif
  171.  
  172.